import request from "../request"


/* 首页接口 */
export const Home = ({pageNum,tagName,productName}) => {
  return request({
    url: '/product',
    method: 'get',
    params:{
      pageNum:pageNum,
      pageSize:10,
      tagName:tagName,
      productName:productName,
    }
  })
}

// 获取tab

export const Tab = () => {
  return request({
    url: '/product/tag',
    method: 'get',
  })
}

// 加入购物车
export const Shopping  = ({i,y}) => {
  return request({
    url: `/carts/${i}/${y}/items`,
    method: 'post',
  })
}

/* 根据id获取用户信息 */
export const ID = ({ id }) => {
  return request({
    url: `/users/${id}`,
    method: 'get',
  })
}

// 获取评论数据
export const comment = ({page}) => {
  return request({
    url: '/post/pages',
    method: 'get',
    params:{
      page:page,
      limit:5
    }
  })
}
// 发布
export const publish = data => {
  return request({
    url: '/post/put-post',
    method: 'post',
    data
  })
}




